package org.fuys.coder.domain.auth.service.common.register.config;

import org.fuys.coder.domain.auth.service.handler.register.RegisterHandlerChain;
import org.fuys.coder.domain.auth.service.handler.register.impl.BeforeSaveHandler;
import org.fuys.coder.domain.auth.service.handler.register.impl.FavoriteInitHandler;
import org.fuys.coder.domain.auth.service.handler.register.impl.SaveUserHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @projectName: fuys-low-coder
 * @package: org.fuys.coder.common.config
 * @className: RegisterHandlerConfig
 * @author: WangJing
 * @description:
 * @date: 2024/6/19 19:55
 * @version: 1.0
 */
@Configuration
public class RegisterHandlerConfig {

    @Resource
    private BeforeSaveHandler beforeSaveHandler;

    @Resource
    private SaveUserHandler saveUserHandler;

    @Resource
    private FavoriteInitHandler favoriteInitHandler;

    @Bean
    public RegisterHandlerChain registerHandlerChain(){
        RegisterHandlerChain registerHandlerChain=new RegisterHandlerChain();
        registerHandlerChain.addHandler(beforeSaveHandler);
        registerHandlerChain.addHandler(saveUserHandler);
        registerHandlerChain.addHandler(favoriteInitHandler);
        return registerHandlerChain;
    }
}
